﻿//-------------------------------------------------------------------------------------
// All Rights Reserved , Copyright (C) 2011 , Hairihan TECH, Ltd.
//-------------------------------------------------------------------------------------

using System.Data;
using System.ServiceModel;

namespace DotNet.IService
{
    using DotNet.Utilities;

    /// <summary>
    /// IPermissionService
    /// 与权限判断等相关的接口定义
    ///
    /// 修改纪录
    ///
    ///		2010.07.06 版本：1.9 JiRiGaLa 数据集权限进行优化处理，统一处理删除标志功能。
    ///		2010.05.24 版本：1.8 JiRiGaLa 增加 角色的权限判断。
    ///		2009.09.09 版本：1.7 JiRiGaLa 增加 GetUserPermissionScope、GetOrganizeIdsByPermission、GetRoleIdsByPermission、GetUserIdsByPermission。
    ///		2008.11.28 版本：1.6 JiRiGaLa 整理为52个标准接口定义，完善 GetLicensePermissionByUser 接口定义。
    ///		2008.11.27 版本：1.5 JiRiGaLa 整理为50个标准接口定义，有些permissionItemCode修改为permissionItemId。
    ///		2008.11.27 版本：1.5 JiRiGaLa 接口改进为B/S系统适合的接口定义 整理为45个标准接口定义。
    ///		2008.11.26 版本：1.4 JiRiGaLa 将权限相关的类方法集中到 IPermissionService 接口中。
    ///		2008.09.02 版本：1.3 JiRiGaLa 将命名修改为 IPermissionService 。
    ///		2008.06.12 版本：1.2 JiRiGaLa 传递类对象。
    ///		2008.05.09 版本：1.1 JiRiGaLa 命名修改为 IPermissionService。
    ///		2008.03.23 版本：1.0 JiRiGaLa 添加权限。
    ///
    /// 版本：1.9
    ///
    /// <author>
    ///		<name>JiRiGaLa</name>
    ///		<date>2010.07.06</date>
    /// </author>
    /// </summary>
    [ServiceContract]
    public interface IPermissionService
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////////
        /// 用户权限判断相关(需要实现对外调用)
        //////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// 01.用户是否在指定的角色里
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="roleName">角色名称</param>
        /// <returns>在角色里</returns>
        [OperationContract]
        bool IsInRole(BaseUserInfo userInfo, string userId, string roleName);

        /// <summary>
        /// 02.当前用户是否有相应的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="permissionItemCode">权限编号</param>
        /// <returns>是否有权限</returns>
        [OperationContract]
        bool IsAuthorized(BaseUserInfo userInfo, string permissionItemCode);

        /// <summary>
        /// 03.某个用户是否有相应的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionItemCode">权限项编号</param>
        /// <returns>是否有权限</returns>
        [OperationContract]
        bool IsAuthorizedByUser(BaseUserInfo userInfo, string userId, string permissionItemCode);

        /// <summary>
        /// 04.某个角色是否有相应的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="permissionItemCode">权限编号</param>
        /// <returns>是否有权限</returns>
        [OperationContract]
        bool IsAuthorizedByRole(BaseUserInfo userInfo, string roleId, string permissionItemCode);

        /// <summary>
        /// 05.当前用户是否超级管理员
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        [OperationContract]
        bool IsAdministrator(BaseUserInfo userInfo);

        /// <summary>
        /// 06.某个用户是否超级管理员
        /// </summary>
        /// <param name="userInfo"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        [OperationContract]
        bool IsAdministratorByUser(BaseUserInfo userInfo, string userId);

        /// <summary>
        /// 07.获得当前用户的所有权限列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <returns>数据表</returns>
        [OperationContract]
        DataTable GetPermissionDT(BaseUserInfo userInfo);

        /// <summary>
        /// 08.获得某个用户的所有权限列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <returns>数据表</returns>
        [OperationContract]
        DataTable GetPermissionDTByUser(BaseUserInfo userInfo, string userId);

        /// <summary>
        /// 09.当前用户是否对某个模块有相应的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="moduleCode">模块编号</param>
        /// <returns>是否有权限</returns>
        [OperationContract]
        bool ModuleIsAuthorized(BaseUserInfo userInfo, string moduleCode);

        /// <summary>
        /// 10.某个用户是否对某个模块有相应的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="moduleCode">模块编号</param>
        /// <returns>是否有权限</returns>
        [OperationContract]
        bool ModuleIsAuthorizedByUser(BaseUserInfo userInfo, string userId, string moduleCode);

        /// <summary>
        /// 11.获得用户的数据集权限范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionScopeCode">权限域编号</param>
        /// <returns>数据集权限范围</returns>
        [OperationContract]
        PermissionScope GetUserPermissionScope(BaseUserInfo userInfo, string userId, string permissionScopeCode);

        //////////////////////////////////////////////////////////////////////////////////////////////////////
        /// 用户权限范围判断相关(需要实现对外调用)
        //////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// 12.按某个数据集权限获取组织列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionScopeCode">权限域编号</param>
        /// <returns>数据表</returns>
        [OperationContract]
        DataTable GetOrganizeDTByPermission(BaseUserInfo userInfo, string userId, string permissionScopeCode);

        /// <summary>
        /// 13.按某个数据集权限获取组织主键数组
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionScopeCode">权限域编号</param>
        /// <returns>主键数组</returns>
        [OperationContract]
        string[] GetOrganizeIdsByPermission(BaseUserInfo userInfo, string userId, string permissionScopeCode);

        /// <summary>
        /// 14.按某个数据集权限获取角色列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionScopeCode">权限域编号</param>
        /// <returns>数据表</returns>
        [OperationContract]
        DataTable GetRoleDTByPermission(BaseUserInfo userInfo, string userId, string permissionScopeCode);

        /// <summary>
        /// 15.按某个数据集权限获取角色主键数组
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionScopeCode">权限域编号</param>
        /// <returns>主键数组</returns>
        [OperationContract]
        string[] GetRoleIdsByPermission(BaseUserInfo userInfo, string userId, string permissionScopeCode);

        /// <summary>
        /// 16.按某个权限域获取用户列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionScopeCode">权限域编号</param>
        /// <returns>数据表</returns>
        [OperationContract]
        DataTable GetUserDTByPermission(BaseUserInfo userInfo, string userId, string permissionScopeCode);

        /// <summary>
        /// 17.按某个数据集权限获取用户主键数组
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionScopeCode">权限域编号</param>
        /// <returns>主键数组</returns>
        [OperationContract]
        string[] GetUserIdsByPermission(BaseUserInfo userInfo, string userId, string permissionScopeCode);

        /// <summary>
        /// 18.按某个权限域获取模块列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionItemCode">权限域编号</param>
        /// <returns>数据表</returns>
        [OperationContract]
        DataTable GetModuleDTByPermission(BaseUserInfo userInfo, string userId, string permissionItemCode);

        /// <summary>
        /// 19.有授权权限的权限列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <returns>数据表</returns>
        [OperationContract]
        DataTable GetLicensePermissionByUser(BaseUserInfo userInfo, string userId);

        /// <summary>
        /// 20.用户的所有可授权范围(有授权权限的权限列表)
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionItemCode">权限域编号</param>
        /// <returns>数据表</returns>
        [OperationContract]
        DataTable GetPermissionDTByPermission(BaseUserInfo userInfo, string userId, string permissionItemCode);

        //////////////////////////////////////////////////////////////////////////////////////////////////////
        /// 角色权限关联关系相关
        //////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// 21.获取角色权限主键数组
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <returns>主键数组</returns>
        [OperationContract]
        string[] GetRolePermissionIds(BaseUserInfo userInfo, string roleId);

        /// <summary>
        /// 22.授予角色的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="grantPermissionIds">授予权限数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int GrantRolePermissions(BaseUserInfo userInfo, string roleId, string[] grantPermissionIds);

        /// <summary>
        /// 22.授予角色的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="grantPermissionId">授予权限</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        string GrantRolePermission(BaseUserInfo userInfo, string roleId, string grantPermissionId);

        /// <summary>
        /// 22.授予角色的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="grantPermissionId">授予权限</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        string GrantRolePermissionById(BaseUserInfo userInfo, string roleId, string grantPermissionId);

        /// <summary>
        /// 23.撤消角色的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="grantPermissionIds">授予权限数组</param>
        /// <param name="revokePermissionIds">撤消权限数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int RevokeRolePermissions(BaseUserInfo userInfo, string roleId, string[] revokePermissionIds);

        /// <summary>
        /// 23.撤消角色的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="revokePermissionId">撤消权限数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int RevokeRolePermission(BaseUserInfo userInfo, string roleId, string revokePermissionId);

        /// <summary>
        /// 23.撤消角色的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="revokePermissionId">撤消权限数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int RevokeRolePermissionById(BaseUserInfo userInfo, string roleId, string revokePermissionId);

        /// <summary>
        /// 24.获取角色的某个权限域的组织范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="permissionItemId">权限主键</param>
        /// <returns>主键数组</returns>
        [OperationContract]
        string[] GetRoleScopeOrganizeIds(BaseUserInfo userInfo, string roleId, string permissionItemId);

        /// <summary>
        /// 25.授予角色的某个权限域的组织范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="permissionItemId">权限主键</param>
        /// <param name="grantOrganizeIds">授予组织主键数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int GrantRoleOrganizeScope(BaseUserInfo userInfo, string roleId, string permissionItemId, string[] grantOrganizeIds);

        /// <summary>
        /// 26.撤消角色的某个权限域的组织范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="permissionItemId">权限主键</param>
        /// <param name="revokeOrganizeIds">撤消的组织主键数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int RevokeRoleOrganizeScope(BaseUserInfo userInfo, string roleId, string permissionItemId, string[] revokeOrganizeIds);

        /// <summary>
        /// 27.获取角色授权权限列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <returns>主键数组</returns>
        [OperationContract]
        string[] GetRoleLicensePermissionIds(BaseUserInfo userInfo, string roleId);

        /// <summary>
        /// 28.授予角色的授权权限范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="grantPermissionIds">授予的权限主键数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int GrantRoleLicensePermission(BaseUserInfo userInfo, string roleId, string[] grantPermissionIds);

        /// <summary>
        /// 29.授予角色的授权权限范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="revokePermissionIds">撤消的权限主键数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int RevokeRoleLicensePermission(BaseUserInfo userInfo, string roleId, string[] revokePermissionIds);

        /// <summary>
        /// 清除权限
        /// </summary>
        /// <param name="userInfo">操作员</param>
        /// <param name="id">主键</param>
        /// <returns>数据表</returns>
        [OperationContract]
        int ClearRolePermission(BaseUserInfo userInfo, string id);

        //////////////////////////////////////////////////////////////////////////////////////////////////////
        /// 用户权限关联关系相关
        //////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// 30.获取用户权限主键数组
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <returns>主键数组</returns>
        [OperationContract]
        string[] GetUserPermissionIds(BaseUserInfo userInfo, string userId);

        /// <summary>
        /// 31.授予用户的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="grantPermissionIds">授予权限数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int GrantUserPermissions(BaseUserInfo userInfo, string userId, string[] grantPermissionIds);

        /// <summary>
        /// 31.授予用户的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="grantPermissionId">授予权限数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        string GrantUserPermissionById(BaseUserInfo userInfo, string userId, string grantPermissionId);

        /// <summary>
        /// 32.撤消用户的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="revokePermissionIds">撤消权限数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int RevokeUserPermission(BaseUserInfo userInfo, string userId, string[] revokePermissionIds);

        /// <summary>
        /// 32.撤消用户的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="revokePermissionId">撤消权限</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int RevokeUserPermissionById(BaseUserInfo userInfo, string userId, string revokePermissionId);

        /// <summary>
        /// 33.获取用户的某个权限域的组织范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionItemId">权限主键</param>
        /// <returns>主键数组</returns>
        [OperationContract]
        string[] GetUserScopeOrganizeIds(BaseUserInfo userInfo, string userId, string permissionItemId);

        /// <summary>
        /// 34.设置用户的某个权限域的组织范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionItemId">权限主键</param>
        /// <param name="grantOrganizeIds">授予的组织主键数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int GrantUserOrganizeScope(BaseUserInfo userInfo, string userId, string permissionItemId, string[] grantOrganizeIds);

        /// <summary>
        /// 35.设置用户的某个权限域的组织范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionItemId">权限主键</param>
        /// <param name="revokeOrganizeIds">撤消的组织主键数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int RevokeUserOrganizeScope(BaseUserInfo userInfo, string userId, string permissionItemId, string[] revokeOrganizeIds);

        /// <summary>
        /// 36.获取用户的某个权限域的角色范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionItemId">权限主键</param>
        /// <returns>主键数组</returns>
        [OperationContract]
        string[] GetUserScopeRoleIds(BaseUserInfo userInfo, string userId, string permissionItemId);

        /// <summary>
        /// 37.设置用户的某个权限域的角色范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionItemId">权限主键</param>
        /// <param name="grantRoleIds">授予的角色主键数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int GrantUserRoleScope(BaseUserInfo userInfo, string userId, string permissionItemId, string[] grantRoleIds);

        /// <summary>
        /// 38.设置用户的某个权限域的角色范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionItemId">权限主键</param>
        /// <param name="revokeRoleIds">撤消的角色主键数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int RevokeUserRoleScope(BaseUserInfo userInfo, string userId, string permissionItemId, string[] revokeRoleIds);

        /// <summary>
        /// 39.获取用户的某个权限域的用户范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionItemId">权限主键</param>
        /// <returns>主键数组</returns>
        [OperationContract]
        string[] GetUserScopeUserIds(BaseUserInfo userInfo, string userId, string permissionItemId);

        /// <summary>
        /// 40.设置用户的某个权限域的用户范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionItemId">权限主键</param>
        /// <param name="grantUserIds">授予的用户主键数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int GrantUserUserScope(BaseUserInfo userInfo, string userId, string permissionItemId, string[] grantUserIds);

        /// <summary>
        /// 41.设置用户的某个权限域的用户范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionItemId">权限主键</param>
        /// <param name="revokeUserIds">撤消的用户主键数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int RevokeUserUserScope(BaseUserInfo userInfo, string userId, string permissionItemId, string[] revokeUserIds);

        /// <summary>
        /// 42.获取用户授权权限列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <returns>主键数组</returns>
        [OperationContract]
        string[] GetUserLicensePermissionIds(BaseUserInfo userInfo, string userId);

        /// <summary>
        /// 43.授予用户的授权权限范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="grantPermissionIds">授予的权限主键数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int GrantUserLicensePermission(BaseUserInfo userInfo, string userId, string[] grantPermissionIds);

        /// <summary>
        /// 44.撤消用户的授权权限范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="revokePermissionIds">撤消的权限主键数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int RevokeUserLicensePermission(BaseUserInfo userInfo, string userId, string[] revokePermissionIds);

        /// <summary>
        /// 清除权限
        /// </summary>
        /// <param name="userInfo">操作员</param>
        /// <param name="id">主键</param>
        /// <returns>数据表</returns>
        [OperationContract]
        int ClearUserPermission(BaseUserInfo userInfo, string id);

        //////////////////////////////////////////////////////////////////////////////////////////////////////
        /// 用户关联模块关系相关
        //////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// 45.获得用户有权限的模块
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <returns>数据表</returns>
        [OperationContract]
        DataTable GetModuleDT(BaseUserInfo userInfo);

        /// <summary>
        /// 46.获得用户有权限的模块
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <returns>数据表</returns>
        [OperationContract]
        DataTable GetModuleDTByUser(BaseUserInfo userInfo, string userId);

        /// <summary>
        /// 47.获取用户模块权限范围主键数组
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionItemCode">权限编号</param>
        /// <returns>主键数组</returns>
        [OperationContract]
        string[] GetUserScopeModuleIds(BaseUserInfo userInfo, string userId, string permissionItemCode);

        /// <summary>
        /// 48.授予用户模块的权限范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="grantModuleId">授予模块主键</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        string GrantUserModuleScope(BaseUserInfo userInfo, string userId, string grantModuleId);

        /// <summary>
        /// 48.授予用户模块的权限范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="grantModuleIds">授予模块主键数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int GrantUserModuleScopes(BaseUserInfo userInfo, string userId, string[] grantModuleIds);

        /// <summary>
        /// 49.撤消用户模块的权限范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="revokeModuleId">撤消模块主键数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int RevokeUserModuleScope(BaseUserInfo userInfo, string userId, string revokeModuleId);

        /// <summary>
        /// 49.撤消用户模块的权限范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="revokeModuleIds">撤消模块主键数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int RevokeUserModuleScopes(BaseUserInfo userInfo, string userId, string[] revokeModuleIds);

        //////////////////////////////////////////////////////////////////////////////////////////////////////
        /// 角色模块关联关系相关
        //////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// 50.获取用户模块权限范围主键数组
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="permissionItemCode">权限编号</param>
        /// <returns>主键数组</returns>
        [OperationContract]
        string[] GetRoleScopeModuleIds(BaseUserInfo userInfo, string roleId, string permissionItemCode);

        /// <summary>
        /// 51.授予用户模块的权限范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="grantModuleIds">授予模块主键数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int GrantRoleModuleScopes(BaseUserInfo userInfo, string roleId, string[] grantModuleIds);

        /// <summary>
        /// 51.授予用户模块的权限范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="grantModuleId">授予模块主键</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        string GrantRoleModuleScope(BaseUserInfo userInfo, string roleId, string grantModuleId);

        /// <summary>
        /// 52.撤消用户模块的权限范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="revokeModuleIds">撤消模块主键数组</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int RevokeRoleModuleScopes(BaseUserInfo userInfo, string roleId, string[] revokeModuleIds);

        /// <summary>
        /// 52.撤消用户模块的权限范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="revokeModuleId">撤消模块主键</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int RevokeRoleModuleScope(BaseUserInfo userInfo, string roleId, string revokeModuleId);

        //////////////////////////////////////////////////////////////////////////////////////////////////////
        /// 资源权限设定关系相关
        //////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// 53.获取资源权限主键数组
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="resourceCategory">资源分类</param>
        /// <returns>主键数组</returns>
        [OperationContract]
        string[] GetResourcePermissionIds(BaseUserInfo userInfo, string resourceCategory, string resourceId);

        /// <summary>
        /// 54.授予资源的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="resourceCategory">资源分类</param>
        /// <param name="resourceId">资源主键</param>
        /// <param name="grantPermissionID">权限主键</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int GrantResourcePermission(BaseUserInfo userInfo, string resourceCategory, string resourceId, string[] grantPermissionIds);

        /// <summary>
        /// 55.撤消资源的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="resourceCategory">资源分类</param>
        /// <param name="resourceId">资源主键</param>
        /// <param name="revokePermissionID">权限主键</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int RevokeResourcePermission(BaseUserInfo userInfo, string resourceCategory, string resourceId, string[] revokePermissionIds);

        //////////////////////////////////////////////////////////////////////////////////////////////////////
        /// 资源权限范围设定关系相关
        //////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// 56.获取资源权限范围主键数组
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="resourceCategory">资源分类</param>
        /// <param name="resourceId">资源主键</param>
        /// <param name="targetCategory">目标类别</param>
        /// <param name="permissionItemCode">权限编号</param>
        /// <returns>主键数组</returns>
        [OperationContract]
        string[] GetPermissionScopeTargetIds(BaseUserInfo userInfo, string resourceCategory, string resourceId, string targetCategory, string permissionItemCode);

        [OperationContract]
        string[] GetPermissionScopeResourceIds(BaseUserInfo userInfo, string resourceCategory, string targetResourceId, string targetResourceCategory, string permissionItemCode);

        /// <summary>
        /// 57.授予资源的权限范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="resourceCategory">资源分类</param>
        /// <param name="resourceId">资源主键</param>
        /// <param name="targetCategory">目标类别</param>
        /// <param name="grantTargetIds">目标主键数组</param>
        /// <param name="permissionItemId">权限主键</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int GrantPermissionScopeTarget(BaseUserInfo userInfo, string resourceCategory, string resourceId, string targetCategory, string[] grantTargetIds, string permissionItemId);

        int GrantPermissionScopeTarget(BaseUserInfo userInfo, string resourceCategory, string[] resourceIds, string targetCategory, string grantTargetId, string permissionItemId);

        /// <summary>
        /// 58.撤消资源的权限范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="resourceCategory">资源分类</param>
        /// <param name="resourceId">资源主键</param>
        /// <param name="targetCategory">目标类别</param>
        /// <param name="revokeTargetIds">目标主键数组</param>
        /// <param name="permissionItemId">权限主键</param>
        /// <returns>影响的行数</returns>
        [OperationContract]
        int RevokePermissionScopeTarget(BaseUserInfo userInfo, string resourceCategory, string resourceId, string targetCategory, string[] revokeTargetIds, string permissionItemId);

        int RevokePermissionScopeTarget(BaseUserInfo userInfo, string resourceCategory, string[] resourceIds, string targetCategory, string revokeTargetId, string permissionItemId);

        /// <summary>
        /// 59.获取用户的某个资源的权限范围(列表资源)
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="targetCategory">目标类别</param>
        /// <param name="permissionItemCode">权限编号</param>
        /// <returns>主键数组</returns>
        [OperationContract]
        string[] GetResourceScopeIds(BaseUserInfo userInfo, string userId, string targetCategory, string permissionItemCode);

        /// <summary>
        /// 60.获取用户的某个资源的权限范围(树型资源)
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="targetCategory">目标类别</param>
        /// <param name="permissionItemCode">权限编号</param>
        /// <param name="childrens">是否含子节点</param>
        /// <returns>主键数组</returns>
        [OperationContract]
        string[] GetTreeResourceScopeIds(BaseUserInfo userInfo, string userId, string targetCategory, string permissionItemCode, bool childrens);
    }
}